#pragma once
#include<iostream>
#include<assert.h>
using namespace std;
namespace bit
{
	class string
	{
	public:
		string()
		
			:_str(new char[1]{'\0' })
			,_size(0)
			,_capacity(0)
		{}
		string(const char* str = "")
		{
			_size = strlen(str);
			_capacity = _size;
			_str = new char[_capacity + 1];
			strcpy(_str, str);
		}
		~string()
		{
			delete[]_str;
			_str = nullptr;
			_capacity = _size = 0;

		}

		const char* c_str()const
		{
			return _str;
		}

		size_t size()const
		{
			return _size;
		}
		char& operator[](size_t pos)
			{
				assert(pos < _size);
		return _str[_size];
			}
	private:
		char* _str;
		size_t _size;
		size_t _capacity;
	};
}